Public Class FrmAdminAccount
    Dim cdata As Data
    Public vAddNew As Boolean = False
    Dim DoCrypt As Encrypt
    Function ConfigureScreen() As Boolean
        cdata = New Data
        cdata.BindingDropDown(Me.cbophycity, "CITY", "CITY", "SELECT DISTINCT CITY FROM TBL_ZIPCODES")
        cdata.BindingDropDown(Me.cbocity, "CITY", "CITY", "SELECT DISTINCT CITY FROM TBL_ZIPCODES")
        Me.TBL_ACCOUNTTableAdapter.Fill(Me.DsTempList.TBL_ACCOUNT)
        Me.DsTempList.AcceptChanges()
        If vAddNew = True Then
            Me.TBLACCOUNTBindingSource.AllowNew = True
            Me.TBLACCOUNTBindingSource.AddNew()
        End If
    End Function

    Private Sub txtPassword_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtPassword.GotFocus
        If Me.txtPassword.Text.Trim <> "" Then
            DoCrypt = New Encrypt
            Me.txtPassword.Text = DoCrypt.decryption(Me.txtPassword.Text.Trim)
        End If
    End Sub

    Private Sub txtPassword_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtPassword.LostFocus
        If Me.txtPassword.Text.Trim <> "" Then
            DoCrypt = New Encrypt
            Me.txtPassword.Text = DoCrypt.encryption(Me.txtPassword.Text.Trim)
        End If
    End Sub
    Private Sub txtPassword_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPassword.TextChanged

    End Sub

    Private Sub FrmAccount_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ConfigureScreen()
    End Sub

    Private Sub cbocity_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbocity.SelectedIndexChanged
        cdata.BindingDropDown(Me.cboZipcode, "ZIPCODE", "ZIPCODE", "SELECT CITY,ZIPCODE FROM TBL_ZIPCODES WHERE CITY LIKE '%" & Me.cbocity.Text & "%'")

    End Sub

    Private Sub cbophycity_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbophycity.SelectedIndexChanged
        cdata.BindingDropDown(Me.cbophyzipcode, "ZIPCODE", "ZIPCODE", "SELECT CITY,ZIPCODE FROM TBL_ZIPCODES WHERE CITY LIKE '%" & Me.cbophycity.Text & "%'")
    End Sub

    Private Sub btn_Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub btn_Close_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Close()
    End Sub

    Private Sub btn_save_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_save.Click
        Me.TBLACCOUNTBindingSource.EndEdit()
        ''DsTempList.TBL_ACCOUNT.Merge(DsTempList.TBL_ACCOUNT)
        Me.TBL_ACCOUNTTableAdapter.Update(DsTempList.TBL_ACCOUNT)
        If vAddNew = True Then
            If Me.TBL_ACCOUNTTableAdapter.GetDataByACCT_ID(1).Rows.Count > 0 Then
                Me.DialogResult = Windows.Forms.DialogResult.OK
                Me.Close()
            Else
                Me.DialogResult = Windows.Forms.DialogResult.No
                Me.Close()
            End If

        End If
    End Sub

    Private Sub btn_Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Cancel.Click
        Me.Close()
    End Sub


    Private Sub lnkUsePostalAdd_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkUsePostalAdd.LinkClicked
        Me.txtphyadd1.Text = Me.txtAdd1.Text
        Me.txtphyadd2.Text = Me.txtAdd2.Text
        Me.txtphyadd3.Text = Me.txtAdd3.Text
        Me.cbophycity.SelectedValue = Me.cbocity.SelectedValue
        cdata.BindingDropDown(Me.cbophyzipcode, "ZIPCODE", "ZIPCODE", "SELECT CITY,ZIPCODE FROM TBL_ZIPCODES WHERE CITY LIKE '%" & Me.cbophycity.Text & "%'")
        Me.cbophyzipcode.SelectedValue = Me.cboZipcode.SelectedValue
        Me.txtphystate.Text = Me.txtState.Text
    End Sub

    Private Sub btn_addNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_addNew.Click
        Me.TBLACCOUNTBindingSource.AddNew()
    End Sub

    Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
        If MessageBox.Show("Do You Want Delete This Account", "Virtual Desk", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
            Me.TBL_ACCOUNTTableAdapter.DeleteQueryByACCT_ID(lblAccount.Text)
            ConfigureScreen()
        End If
    End Sub

    Private Sub DG_Accounts_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DG_Accounts.CellContentClick

    End Sub

    Private Sub DG_Accounts_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DG_Accounts.Click
       
    End Sub
End Class